﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;
using System.BusinessObjects.Transactions;
using NHibernate.Criterion;

namespace Blazing.BusinessObjects.Queries
{
    public class QrySearchSettingsBySite
    {
        public static ICriteria Query(int SiteID)
        {
            ICriteria qry = UnitOfWork.CurrentSession.CreateCriteria(typeof(Setting))
                .Add(Expression.Eq("Site.ID", SiteID))
                .AddOrder(Order.Asc("Name"));
            return qry;
        }

        public static ICriteria Query(int SiteID, string settingKey)
        {
            ICriteria qry = UnitOfWork.CurrentSession.CreateCriteria(typeof(Setting))
                .Add(Expression.Eq("Name", settingKey))
                .Add(Expression.Eq("Site.ID", SiteID))
                .AddOrder(Order.Asc("Name"));
            return qry;
        }
    }
}
